/*
 * @Author       : NaN 353362604@qq.com
 * @Date         : 2023-06-09 10:37:55
 * @LastEditTime : 2023-08-13 16:36:09
 * @LastEditors  : NaN 353362604@qq.com
 * @FilePath     : \AdminStration\src\Common\Router\MenuNav\FirstLevel\TunnelPersonGate.jsx
 * @Description  :
 */

import { API_LIST } from '../../../Api/Api'
import { commonTableList, BuiltInData } from '../Common/common'
import { DelDataButton } from '../Common/options'

export const TunnelPersonGate = async ({ url, OptionsEvent, ClientData, Permission }) => {
    let data = {
        type: '隧道管理',
        pageSize: 10,
        params: { pageIndex: 1, OrderField: 'attendanceTime@desc' },
        get: API_LIST()[`get${url}`],
        modify: `put${url}`,
        delete: `del${url}`,
        columns: [
            commonTableList.uuid,
            { ...commonTableList.organizationUuid, valueEnum: ClientData.organization },
            {
                dataIndex: 'attendanceTime',
                title: '进出时间',
                valueType: 'Date',
                showTime: true,
                width: 150,
                hideInSearch: true,
            },
            {
                dataIndex: 'tableName',
                title: '姓名',
                valueType: 'input',
                width: 100,
            },
            {
                dataIndex: 'identityCard',
                title: '身份证号',
                valueType: 'input',
                width: 150,
            },
            {
                dataIndex: 'inOrOut',
                title: '状态',
                valueType: 'select',
                valueEnum: BuiltInData.carInOrOut,
                width: 100,
            },
            {
                dataIndex: 'deviceSerial',
                title: '设备序列号',
                valueType: 'input',
                width: 150,
            },
            commonTableList.BeginTime,
            commonTableList.EndTime,
            commonTableList.createUserName,
            commonTableList.createTime,
            {
                title: '操作',
                valueType: 'systemOperation',
                fixed: 'right',
                width: 100,
                hideInSearch: true,
                hideInAdded: true,
                hideInModify: true,
                render: (_, record) => {
                    return [
                        Permission.findIndex(v => v.uuid === 'b199261a-0f9e-4b87-bc2f-2b71faa8712a') !== -1 && (
                            <DelDataButton
                                OptionsEvent={OptionsEvent}
                                key="del"
                                title="删除"
                                url={url}
                                uuid={record.uuid}
                            />
                        ),
                    ]
                },
            },
        ],
    }

    return data
}
